package com.qf.edu.service;

import com.alibaba.fastjson.JSONObject;
import com.qf.edu.Constants;
import com.qf.edu.bean.HotVideo;
import com.qf.edu.bean.HotVideoCommon;
import com.qf.edu.utils.Request;

import java.util.List;

/**
 * @author: 吾忆
 * @email: 2432605231@qq.com
 * @phone:13677982829
 * @desc:
 * @DateTime: 2021/12/22 23:01
 **/

public class HotVideoService {
    /**
     * 该方法用于获取热门数据，并将热门数据返回
     * @return
     */
    public List<HotVideo> getHotVideo(){
        String url = Constants.GAME_URL
                + "?key=" + Constants.GAME_KEY
                + "&type=hot_video"
                + "&size=20";
        String result = Request.get(url);
        System.out.println(result);

        //json解析
        HotVideoCommon videoCommon = JSONObject.parseObject(result,HotVideoCommon.class);

        return videoCommon.result;
    }
}
